//
//  BBXFTypeViewController.m
//  BearSiX
//
//  Created by Tom on 16/3/26.
//  Copyright © 2016年 Tom. All rights reserved.
//

#import "BBXFTypeViewController.h"

@interface BBXFTypeViewController ()<UITableViewDelegate,UITableViewDataSource>
{

    UITextField *_nameField;
    UITextField *_phoneField;
}
@property(nonatomic,strong)UITableView *tableView;
@property(nonatomic,strong)NSArray *dataArr;
@end

@implementation BBXFTypeViewController
-(NSArray *)dataArr{

    if (!_dataArr) {
        _dataArr = @[@"婚纱照",@"儿童照",@"亲子照",@"纪念日照",@"全家福照",@"闺蜜照",@"好兄弟照"];
    }
    return _dataArr;
}
-(UITableView *)tableView{

    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WINSIZEWIDTH, WINSIZEHEIGHT)];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.tableFooterView =[[UIView alloc]init];
    }
    return _tableView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"消费类型";
    [self.view addSubview:self.tableView];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return self.dataArr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:nil];
    cell.textLabel.text = self.dataArr[indexPath.row];
//    if (indexPath.row==3) {
//        _nameField = [[UITextField alloc]initWithFrame:CGRectMake(100, 0, WINSIZEWIDTH/2, 140)];
//        _nameField.backgroundColor = [UIColor redColor];
//        [cell addSubview:_nameField];
//        _nameField.placeholder = @"请输入姓名";;
//    }
    if ([cell.textLabel.text isEqualToString:self.XFtype]) {
    
        cell.tintColor = [UIColor colorWithHexString:@"ef1937"];
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    }
    //cell.accessoryView.backgroundColor = [UIColor colorWithHexString:@"ef1937"];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    self.XFtype = [NSString stringWithFormat:@"%@",self.dataArr[indexPath.row]];
    self.type = ^(NSString *data){
        data = self.XFtype;
    };
    [self.tableView reloadData];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
